//
//  HeaderViewForClickCell.m
//  SeeTheWorld
//
//  Created by dllo on 16/1/25.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "HeaderViewForClickCell.h"
#import <UIImageView+WebCache.h>
#import "ModelOfClickShouYeCell.h"

@interface HeaderViewForClickCell ()

@property (nonatomic, retain)UIImageView *imageViewForHeader;
@property (nonatomic, retain)UIImageView *imageViewForTouXiang;
@property (nonatomic, retain)UILabel *labelForName;
@property (nonatomic, retain)UILabel *labelForStartDate;

@end

@implementation HeaderViewForClickCell

- (void)dealloc {
    [_labelForStartDate release];
    [_labelForName release];
    [_imageViewForTouXiang release];
    [_imageViewForHeader release];
    [super dealloc];
}

- (instancetype)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithReuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createSubviews];
        
    }
    return self;
}

/** 创建子视图 */
- (void)createSubviews {
    
    self.imageViewForHeader = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageViewForHeader];
    [_imageViewForHeader release];
   
    self.imageViewForTouXiang = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imageViewForTouXiang];
    [_imageViewForTouXiang release];
    
    self.labelForName = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelForName];
    [_labelForName release];
    self.labelForName.textColor = [UIColor whiteColor];
    
    self.labelForStartDate = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelForStartDate];
    [_labelForStartDate release];
    self.labelForStartDate.textColor = [UIColor whiteColor];
    
    
}

/** 布局子视图 */
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.imageViewForHeader.frame = self.contentView.frame;
    
    self.imageViewForTouXiang.frame = CGRectMake(10, self.contentView.frame.size.height - 55, 45, 45);
    self.imageViewForTouXiang.layer.cornerRadius = self.contentView.frame.size.height / 4 / 2;
    self.imageViewForTouXiang.layer.masksToBounds = YES;
    
    self.labelForName.frame = CGRectMake(60, self.contentView.frame.size.height - 55, self.contentView.frame.size.width - 55, 25);
    
    self.labelForStartDate.frame = CGRectMake(60, self.contentView.frame.size.height - 30, 100, 25);
    
}

/** 赋值 */
- (void)passModel:(ModelOfClickShouYeCell *)model {
  
    [self.imageViewForHeader sd_setImageWithURL:[NSURL URLWithString:model.front_cover_photo_url] placeholderImage:[UIImage imageNamed:@"1f178a82b9014a90e9109296ad773912b31beeeb"]];
    
    self.labelForName.text = model.name;
    
    self.labelForStartDate.text = model.start_date;
    
    [self.imageViewForTouXiang sd_setImageWithURL:[NSURL URLWithString:[model.user objectForKey:@"image"]] placeholderImage:[UIImage imageNamed:@"1f178a82b9014a90e9109296ad773912b31beeeb"]];

}








@end
